package benlai_miniprogram;

import ocg.common.re.reports.ExtentTestNGReportBuilder;
import ocg.http.httpcore.Basic;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Listeners;

/**
 * Created by chenbo on 2018/5/8.
 */
public class BaseApi extends ExtentTestNGReportBuilder{

    public Logger logger = LogManager.getLogger( this.getClass() );

    @BeforeSuite
    public void init(){
        logger.info ( "初始化接口请求参数!" );
        SqlAssert.sqlAssert ();
        if ( HttpConf.getHeaders () != null) {
            Basic.addHeaders ( HttpConf.getHeaders () );
            Basic.setScheme ( HttpConf.getScheme () );
            Basic.setHost ( HttpConf.getHost () );
            Basic.setIp ( HttpConf.getIp ());
            Basic.setPart ( HttpConf.getPart () );
        }
    }

    @AfterSuite
    public void endTest(){

        /**
         * 测试结束，关闭在 SqlAssert 打开的数据库资源
         */
        SqlAssert.close ();
    }
}







